#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>

void* thread_fun(void*);

int main(int argc,char** argv)
{
  pthread_t tid;
  int* data;
  data = malloc(sizeof(int));
  int ret;
  for(int i = 0;i < 5;i++)
  {
    *data = i + 1;
    ret = pthread_create(&tid,NULL,thread_fun,data);
    if(ret != 0)
    {
      fprintf(stderr,"ptread_create is fail\n");
      return -1;
    }
    usleep(100);
  }
  
  sleep(5);
  free(data);
  return 0;
}

void* thread_fun(void* num)
{
  printf("I am %dth,my pid is %d,mu tid is %lu\n",*(int*)num,getpid(),pthread_self());

  return NULL;
}
